let baseURI = "http://47.108.153.85:9291"
let token = "eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIxIiwic3ViIjoiYWRtaW4iLCJpYXQiOjE2MzQ1NjYyMDcsImlzcyI6IlNDUk0ifQ.DWelS0rWAqS1hvjBSYiyQP96UdZRYBCzbE5DC1UxsDKcG7neRwAUTKNqm0bKbx5CxD78Hz7YGKWEJZsrYblXjw"
let tokenKey = "905ae276-37f4-48f4-94f8-7e10a0829091"
let http = function(reqBody) {
	let {
		url,
		method,
		data
	} = reqBody;
	let header = {}
	// let {
	// 	token,
	// 	tokenKey
	// } = uni.getStorageInfoSync("loginInfo")

	if (token) {
		header = {
			"Authorization": token,
			"Authorization-key": tokenKey
		}
	}
	return new Promise((resolve,reject)=>{
		uni.request({
			method,
			url: baseURI + url,
			data,
			header,
			success: (res) => {
				let result = res.data
				resolve(result)
			},
			fail: (e) => {
				reject(e)
			}
		})
	})
}

export default http;
